package com.iteaj.iot.test;

import com.sun.management.OperatingSystemMXBean;

import java.lang.management.ManagementFactory;
import java.util.UUID;

/**
 * 服务器信息
 */
public class ServerInfoUtil {

    public static void main(String[] args) {
        final long processCpuTime = system().getProcessCpuTime();
        System.out.println(processCpuTime);
    }
    public static OperatingSystemMXBean system() {
        OperatingSystemMXBean operatingSystemMXBean =
                (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();

        operatingSystemMXBean.getProcessCpuTime();

        return operatingSystemMXBean;
    }

    public static String getMessageId() {
        return UUID.randomUUID().toString();
    }
}
